// import com.alibaba.druid.sql.ast.SQLExpr_ptr;
// import com.alibaba.druid.sql.ast.SQLName_ptr;
// import com.alibaba.druid.sql.ast.SQLStatementImpl;
// import com.alibaba.druid.sql.ast.statement.SQLCreateStatement;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

// import java.util.HashMap;
// import java.util.Map;

#include "SQLCreateResourceGroupStatement.h"
#include "../../../../visitor/SQLASTVisitor.h"
#include "../../../../ast/SQLExpr.h"
#include "../../../../ast/SQLName.h"

SQLCreateResourceGroupStatement::SQLCreateResourceGroupStatement()
{
  properties = std::make_shared<std::map<string_ptr, SQLExpr_ptr>>();
}
SQLName_ptr SQLCreateResourceGroupStatement::getName()
{
  return name;
}

void SQLCreateResourceGroupStatement::setName(SQLName_ptr x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLCreateResourceGroupStatement));
  }
  this->name = x;
}

void SQLCreateResourceGroupStatement::addProperty(string_ptr name, SQLExpr_ptr value)
{
  if (value != nullptr)
  {
    value->setParent(SharedObject(SQLCreateResourceGroupStatement));
  }
  properties->insert(std::make_pair(name, value));
}

BOOL_ptr SQLCreateResourceGroupStatement::getEnable()
{
  return enable;
}

void SQLCreateResourceGroupStatement::setEnable(BOOL_ptr enable)
{
  this->enable = enable;
}

std::shared_ptr<std::map<string_ptr, SQLExpr_ptr>> SQLCreateResourceGroupStatement::getProperties()
{
  return properties;
}

void SQLCreateResourceGroupStatement::accept0(SQLASTVisitor_ptr v)
{
  if (v->visit(SharedObject(SQLCreateResourceGroupStatement)))
  {
    acceptChild(v, name);
    for (auto it : *properties)
    {
      auto value = it.second;
      acceptChild(v, value);
    }
  }
  v->endVisit(SharedObject(SQLCreateResourceGroupStatement));
}
